package april;

/**
 * @author ：冯涛滔
 * @date ：Created in 2020-4-17 20:48
 * @description： 4月27
 * @modified By：
 * @version:
 */
public class April17 {
    /**
     * create by: 冯涛滔
     * description: https://leetcode-cn.com/problems/jump-game/
     * create time: 2020-4-17 20:48
     * @params [nums]
     * @return boolean
     */
    public boolean canJump(int[] nums) {
        int max = 0;
        int length = nums.length;

        for (int i = 0; i < length; i++) {
            if(i<=max){
                if(nums[i]+i>max){
                    max = nums[i]+i;
                }
                if(max>=length-1){
                    return true;
                }
            }

        }
        return false;
    }
}
